﻿using System.Collections.Generic;

namespace TextCompare
{
    class CompareCharControl : ICompareControl
    {
        public double CorrectPercent { get; set; }

        public IEnumerable<MatchPoint> GenerateComparedText(string source, string target)
        {
            return Compare(source, target);
        }

        private IEnumerable<MatchPoint> Compare(string source, string target)
        {
            TextMatch match = new TextMatch(TextMatcher(source,target));
            var points = match.Match();
            CorrectPercent = match.CorrectPercent;
            return points;
        }

        public ITextMatcher TextMatcher(string sourceText, string targetText)
        {
            return new CharTextMatcher(sourceText, targetText);
        }
    }
}
